package com.ruoyi.perfomance.mapper;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ruoyi.perfomance.domain.ScBaseDaily;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

/**
 * 日报管理Mapper接口
 * 
 * @author mazheng
 * @date 2021-08-13
 */
@Repository("performanceScBaseDailyMapper")
public interface ScBaseDailyMapper 
{
    /**
     * 查询日报管理
     * 
     * @param id 日报管理主键
     * @return 日报管理
     */
    public ScBaseDaily selectScBaseDailyById(Long id);

    /**
     * 查询日报管理列表
     * 
     * @param scBaseDaily 日报管理
     * @return 日报管理集合
     */
    public List<ScBaseDaily> selectScBaseDailyList(ScBaseDaily scBaseDaily);



    public List<ScBaseDaily> selectScBaseDailyList1(ScBaseDaily scBaseDaily);

    /**
     * 新增日报管理
     * 
     * @param scBaseDaily 日报管理
     * @return 结果
     */
    public int insertScBaseDaily(ScBaseDaily scBaseDaily);

    /**
     * 修改日报管理
     * 
     * @param scBaseDaily 日报管理
     * @return 结果
     */
    public int updateScBaseDaily(ScBaseDaily scBaseDaily);

    /**
     * 删除日报管理
     * 
     * @param id 日报管理主键
     * @return 结果
     */
    public int deleteScBaseDailyById(Long id);

    /**
     * 批量删除日报管理
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteScBaseDailyByIds(Long[] ids);


    @Select("<script>SELECT t1.id, t1.teacher_id teacherId, t1.problom_txt problomTxt, t1.task_txt taskTxt, \n" +
            "t1.daily_date dailyDate, t1.daily_count dailyCount, t1.leavecount, t1.leavename, t2.cname,\n" +
            " t3.tname, t1.class_id classId, \n" +
            "  CONCAT(t5.dname,'|',sbcs.sname,'|', sbcc.chapter_name) AS chapter\n" +
            " FROM sc_base_daily t1 JOIN sc_base_clazz_mst t2 ON t1.class_id = t2.id \n" +
            " JOIN sc_base_teacher_mst t3 ON t1.teacher_id = t3.id\n" +
            " LEFT JOIN sc_base_course_direction t5 ON t1.dirctory = t5.id\n" +
            "        LEFT JOIN sc_base_course_stage sbcs ON t1.stageid = sbcs.id\n" +
            "        LEFT join sc_base_course_chapter sbcc ON sbcc.id = t1.chapter_id" +
            "  <where>  \n" +
            "            <if test=\"teacherId != null \"> and teacher_id = #{teacherId}</if>\n" +
            "            <if test=\"classId != null \"> and class_id = #{classId}</if>\n" +
            "            <if test=\"chapterId != null \"> and chapter_id = #{chapterId}</if>\n" +
            "            <if test=\"dailyDate != null  and dailyDate != ''\"> and daily_date = #{dailyDate}</if>\n" +
            "        </where>\n" +
            "ORDER BY t1.id DESC</script>")
    public List<HashMap> selectScBaseDailyListHashMap(ScBaseDaily scBaseDaily);


    int insertScBaseDaily1(Map map);

    ScBaseDaily selectScBaseDailyById1(Long id);
}
